<% layout('/layouts/default.html', {title: 'dc_sup_task_group_unit管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-tools pull-right">

			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${dcSupTaskGroupUnit}" action="${ctx}/task/dcSupTaskGroupUnit/listData" method="post" class="form-inline "
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<!--				<div class="form-group">-->
<!--					<label class="control-label">${text('单位编码')}：</label>-->
<!--					<div class="control-inline">-->
						<#form:hidden path="groupId" />
<!--						<#form:input path="unitCode" maxlength="100" class="form-control width-120"/>-->
<!--					</div>-->
<!--				</div>-->
<!--				<div class="form-group">-->
<!--					<label class="control-label">${text('单位名称')}：</label>-->
<!--					<div class="control-inline">-->
<!--						<#form:input path="unitName" maxlength="100" class="form-control width-120"/>-->
<!--					</div>-->
<!--				</div>-->
				<div class="form-group">
					<i class="fa ">	<a href="#"  class="btn btn-primary" onclick="addUnit('${dcSupTaskGroupUnit.groupId}')"    style="" title="${text("机构录入")}">机构录入</a>
					</i>
<!--					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>-->
<!--					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>-->
				</div>
			</#form:form>
			<table id="dataGrid"></table>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
	/*	{header:'${text("主键")}', name:'id', index:'a.id', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/task/dcSupTaskGroupUnit/form?id='+row.id+'" class="btnList" data-title="${text("编辑dc_sup_task_group_unit")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("常用组id")}', name:'groupId', index:'a.group_id', width:150, align:"left"},*/
		// {header:'${text("单位编码")}', name:'unitCode', index:'a.unit_code', width:150, align:"left"},
		{header:'${text("单位名称")}', name:'unitName', index:'a.unit_name', width:150, align:"left"
			,formatter: function(val, obj, row, act){
				return row.unitName+'<a href="${ctx}/task/dcSupTaskGroupUnit/delete?id='+row.id+'" style="float: right;" class="btnList" title="${text("删除机构")}" data-confirm="${text("确认要删除该机构吗？")}"><i class="fa fa-trash-o"></i></a>';
			},unformat: function(val, obj, cell){
				return $('#'+obj.rowId+'_unitName').val();
			}},
	],
	inputPageSize:10000,
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});

function addUnit(groupId){
	js.layer.open({
		type: 2,
		title: ['新增常用组机构'],
		area: ['600px', '400px'],
		scrollbar: true,
		shadeClose: false,
		content: "${ctx}/task/dcSupTaskGroupUnit/form?groupId="+groupId,
		btn1: function (index, layero) {
		},
		end:function () {
			location.reload();
		}
	});

}
</script>